package model

import "gorm.io/gorm"

type Video struct {
	gorm.Model
	Title    string `gorm:"type:varchar(50);commit:标题"`
	Type     string `gorm:"type:varchar(30);commit:分类"`
	VideoUrl string `gorm:"type:varchar(225);commit:视频URL"`
	Label    string `gorm:"type:varchar(30);commit:标签"`
	Cover    string `gorm:"type:varchar(225);commit:封面"`
	Status   string `gorm:"type:varchar(30);commit:状态:1:正常,2:损坏"`
}

func (v *Video) VideoAdd(db *gorm.DB) error {
	err := db.Create(&v).Error
	return err
}
func (v *Video) VideoList(db *gorm.DB, VideoId int) error {
	err := db.Create(&v).Error
	return err
}

// 审核表
type Review struct {
	gorm.Model
	VideoId  int    `gorm:"type:int;commit:视频ID"`
	ReviewId int    `gorm:"type:int;commit:审核员ID"`
	Result   string `gorm:"type:varchar(50);commit:审核结果"`
	Opinion  string `gorm:"type:varchar(225);commit:审核意见"`
}

func (r *Review) ReviewAdd(db *gorm.DB) error {
	err := db.Create(&r).Error
	return err
}
